//
//  SINAPhotoPopView.m
//  sinashebao
//
//  Created by  androidlongs on 2017/12/28.
//  Copyright © 2017年  androidlongs. All rights reserved.
//

#import "SINAStudentServiceItemPop.h"
#import "SINACircularBeadUtils.h"
#import "SINAUiviewClickLiserner.h"
#import "SINACalendarUtils.h"


@interface  SINAStudentServiceItemPop ()



//用户头像
@property(strong,nonatomic) UIImageView *userTitleImageView ;


//快递服务 收货人
@property(strong,nonatomic)  UILabel *consigneeUILabel;
//快递服务 收货地址
@property(strong,nonatomic) UILabel *consigneeLocationUILabel;
//快递服务 联系电话
@property(strong,nonatomic) UILabel *peoplePhoneUILabel;
//快递服务 服务时间
@property(strong,nonatomic)UILabel *serviceTimeUILabel;

//快递服务中的  快递公司
@property(strong,nonatomic)UILabel *buyBehalfUILabel;

//快递服务酬金
@property(strong,nonatomic)UILabel *moneyUILabel;
@property(strong,nonatomic)UILabel *moneyNumberUILabel;

//备注
@property(strong,nonatomic) UILabel *remarkUILabel ;
@property(strong,nonatomic) UILabel *remarkDesUILabel;

//再逛一逛
@property(strong,nonatomic) UILabel *cancleUILabel;

//接受
@property(strong,nonatomic) UILabel *selectUILabel;


@end

@implementation SINAStudentServiceItemPop

/*
 // Only override drawRect: if you perform custom drawing.
 // An empty implementation adversely affects performance during animation.
 - (void)drawRect:(CGRect)rect {
 // Drawing code
 }
 */

-(instancetype)initWithPageType:(NSInteger)pageType andWithPageStatue:(NSInteger)pageStatue{
    self = [super init];
    if (self) {
        self.pageType=pageType;
        self.pageStute=pageStatue;
        
        DLog(@"弹框 pageType %ld  pageStute %ld  ",(long)self.pageType,(long)self.pageStute);
        if (self.pageType==0) {
            //"快递服务"
            if (self.pageStute==0) {
                //兼职
            } else {
                //达人
            }
        }else if(self.pageType==1){
            //打印复印" forKey:@"serviceType"];
        }else if(self.pageType==2){
            //稍饭带饭" forKey:@"serviceType"];
        }else if(self.pageType==3){
            //超市代购" forKey:@"serviceType"];
        }
        
        self.bounds = [UIScreen mainScreen].bounds;
        self.backgroundColor = [UIColor colorWithRed:0 green:0 blue:0 alpha:0.64];
        self.layer.opacity = 0.0;
        
        UITapGestureRecognizer *tap=[[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(disMiss)];
        self.userInteractionEnabled = YES;
        [self addGestureRecognizer:tap];
        
        [self addSubview:self.contentView];
        
        self.contentView.frame = CGRectMake(self.contentView.frame.origin.x, self.contentView.frame.origin.y, self.contentView.frame.size.width, self.contentView.frame.size.height);
        //圆角
        [SINACircularBeadUtils makeCircularBead:5 andView:self.contentView];
        
        
        UIImageView *headerImageView = [[UIImageView alloc]initWithFrame:CGRectMake(0, 0, CGRectGetWidth(self.contentView.frame), 132)];
        headerImageView.image = [UIImage imageNamed:@""];
        [self.contentView addSubview:headerImageView];
        
        headerImageView.image = [UIImage imageNamed:@"person_infor_bg"];
        //用户头像
        UIImageView *userTitleImageView = [[UIImageView alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.contentView.frame)/2-36, 97, 72, 72)];
        userTitleImageView.image = [UIImage imageNamed:@""];
        [self.contentView addSubview:userTitleImageView];
        [SINACircularBeadUtils makeCircularView:userTitleImageView];
        
        self.userTitleImageView = userTitleImageView;
        
        //收货人
        
        UILabel *consigneeUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetHeight(headerImageView.frame)+36, CGRectGetWidth(self.contentView.frame)-48, 22)];
        consigneeUILabel.text=@"收货人 : 张三";
        consigneeUILabel.textAlignment=NSTextAlignmentLeft;
        consigneeUILabel.font=[UIFont systemFontOfSize:14];
        consigneeUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        self .consigneeUILabel=consigneeUILabel;
        [self.contentView addSubview:consigneeUILabel];
        
        
        //收货地址
        UILabel *consigneeLocationUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(consigneeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        consigneeLocationUILabel.text=@"收货地址 : 山西大学东校区东门";
        consigneeLocationUILabel.textAlignment=NSTextAlignmentLeft;
        consigneeLocationUILabel.font=[UIFont systemFontOfSize:14];
        consigneeLocationUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        
        if(self.pageStute==0&&self.pageType==0){
            //快递兼职
            self.consigneeLocationUILabel = consigneeLocationUILabel;
            [self.contentView addSubview:consigneeLocationUILabel];
        }else if(self.pageStute==1&&self.pageType==0){
            //快递委托
            //无
        }else if(self.pageStute==0&&self.pageType==1){
            //打印复印 兼职
            self.consigneeLocationUILabel = consigneeLocationUILabel;
            [self.contentView addSubview:consigneeLocationUILabel];
        }else if((self.pageStute==1&&self.pageType==1)||(self.pageType==2)){
            //打印复印 委托
            //稍饭带饭
            self.consigneeLocationUILabel = consigneeLocationUILabel;
            [self.contentView addSubview:consigneeLocationUILabel];
        }else if(self.pageStute==0&&self.pageType==3){
            //超市代购 兼职
            self.consigneeLocationUILabel = consigneeLocationUILabel;
            [self.contentView addSubview:consigneeLocationUILabel];
        }else{
             //超市代购 委托
        }
        
        
        
        
        //联系电话
        UILabel *peoplePhoneUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(consigneeLocationUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        peoplePhoneUILabel.text=@"联系电话 : 136669090";
        peoplePhoneUILabel.textAlignment=NSTextAlignmentLeft;
        peoplePhoneUILabel.font=[UIFont systemFontOfSize:14];
        peoplePhoneUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        
        if(self.pageStute==0&&self.pageType==0){
            //快递兼职
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeLocationUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }else if(self.pageStute==1&&self.pageType==0){
            //快递委托
            //无
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }else if(self.pageStute==0&&self.pageType==1){
            //打印复印 兼职
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeLocationUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }else if((self.pageStute==1&&self.pageType==1)||(self.pageType==2)){
            //打印复印 委托
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeLocationUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }else if(self.pageStute==0&&self.pageType==3){
            //超市代购 兼职
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeLocationUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }else{
            //超市代购 委托
            peoplePhoneUILabel.frame=CGRectMake(24,CGRectGetMaxY(consigneeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.peoplePhoneUILabel=peoplePhoneUILabel;
            [self.contentView addSubview:peoplePhoneUILabel];
        }
        
        
        
        //服务时间
        UILabel *serviceTimeUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(peoplePhoneUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        serviceTimeUILabel.text=@"服务时间 : 12:00-19:00";
        serviceTimeUILabel.textAlignment=NSTextAlignmentLeft;
        serviceTimeUILabel.font=[UIFont systemFontOfSize:14];
        serviceTimeUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        
        if(self.pageStute==0&&self.pageType==0){
            //快递兼职
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }else if(self.pageStute==1&&self.pageType==0){
            //快递委托
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }else if(self.pageStute==0&&self.pageType==1){
            //打印复印 兼职
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }else if((self.pageStute==1&&self.pageType==1)||(self.pageType==2)){
            //打印复印 委托
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }else if(self.pageStute==0&&self.pageType==3){
            //超市代购 兼职
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }else{
            //超市代购 委托
            self.serviceTimeUILabel = serviceTimeUILabel;
            [self.contentView addSubview:serviceTimeUILabel];
        }
        
        //代购方式
        //快递服务中的  快递公司
        UILabel *buyBehalfUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        buyBehalfUILabel.text=@"代购方式 : 校内";
        buyBehalfUILabel.textAlignment=NSTextAlignmentLeft;
        buyBehalfUILabel.font=[UIFont systemFontOfSize:14];
        buyBehalfUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        
        if(self.pageStute==0&&self.pageType==0){
            //快递兼职
            self.buyBehalfUILabel=buyBehalfUILabel;
            [self.contentView addSubview:buyBehalfUILabel];
        }else if(self.pageStute==1&&self.pageType==0){
            //快递委托
            //无
        }else if(self.pageStute==0&&self.pageType==1){
            //打印复印 兼职
        }else if(self.pageStute==1&&self.pageType==1){
        }else if(self.pageType==2){
        }else if(self.pageStute==0&&self.pageType==3){
            //超市代购 兼职
            self.buyBehalfUILabel=buyBehalfUILabel;
            [self.contentView addSubview:buyBehalfUILabel];
        }else{
            //超市代购 委托
            self.buyBehalfUILabel=buyBehalfUILabel;
            [self.contentView addSubview:buyBehalfUILabel];
        }
        
        // 快递服务
        //酬金
        UILabel *moneyUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        moneyUILabel.text=@"酬金:";
        moneyUILabel.textAlignment=NSTextAlignmentLeft;
        moneyUILabel.font=[UIFont systemFontOfSize:14];
        moneyUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        
        
        
        
        UILabel *moneyNumberUILabel = [[UILabel alloc]initWithFrame:CGRectMake(64,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22)];
        moneyNumberUILabel.text=@"4RMB";
        moneyNumberUILabel.textAlignment=NSTextAlignmentLeft;
        moneyNumberUILabel.font=[UIFont systemFontOfSize:14];
        moneyNumberUILabel.textColor=[UIColor redColor];
        
        
        if(self.pageStute==0&&self.pageType==0){
            //快递兼职
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
            moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }else if(self.pageStute==1&&self.pageType==0){
            //快递委托
            //无
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
             moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }else if(self.pageStute==0&&self.pageType==1){
            //打印复印 兼职
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
            moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }else  if((self.pageStute==1&&self.pageType==1)||(self.pageType==2)){
            //打印复印 委托
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
            moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(serviceTimeUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }else if(self.pageStute==0&&self.pageType==3){
            //超市代购 兼职
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
            moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }else{
            //超市代购 委托
            moneyUILabel.frame=CGRectMake(24,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22);
            self.moneyUILabel =moneyUILabel;
            [self.contentView addSubview:moneyUILabel];
            moneyNumberUILabel.frame=CGRectMake(64,CGRectGetMaxY(buyBehalfUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-84, 22);
            self.moneyNumberUILabel =moneyNumberUILabel;
            [self.contentView addSubview:moneyNumberUILabel];
        }
        
        
        
        
        //备注
        UILabel *remarkUILabel = [[UILabel alloc]initWithFrame:CGRectMake(24,CGRectGetMaxY(moneyUILabel.frame)+4, CGRectGetWidth(self.contentView.frame)-48, 22)];
        remarkUILabel.text=@"备注:";
        remarkUILabel.textAlignment=NSTextAlignmentLeft;
        remarkUILabel.font=[UIFont systemFontOfSize:14];
        remarkUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        self.remarkUILabel = remarkUILabel;
        [self.contentView addSubview:remarkUILabel];
        
        
        UILabel *remarkDesUILabel = [[UILabel alloc]initWithFrame:CGRectMake(64,CGRectGetMaxY(moneyUILabel.frame)+8, CGRectGetWidth(self.contentView.frame)-80, 21)];
        remarkDesUILabel.text=@"考虑功能性应用程序";
        remarkDesUILabel.font=[UIFont systemFontOfSize:14];
        remarkDesUILabel.textColor=[UIColor colorWithHexString:@"#2e2e2e"];
        remarkDesUILabel.numberOfLines=3;
        
        self.remarkDesUILabel=remarkDesUILabel;
        [self.contentView addSubview:remarkDesUILabel];
        
        
        //再逛一逛
        
        UILabel *cancleUILabel = [[UILabel alloc]initWithFrame:CGRectMake(15,CGRectGetMaxY(remarkDesUILabel.frame)+8, CGRectGetWidth(self.contentView.frame)/2-25, 32)];
        cancleUILabel.text=@"再逛一逛";
        cancleUILabel.textAlignment=NSTextAlignmentCenter;
        cancleUILabel.font=[UIFont systemFontOfSize:16];
        cancleUILabel.textColor=[UIColor colorWithHexString:@"#ffffff"];
        self.cancleUILabel =cancleUILabel;
        [self.contentView addSubview:cancleUILabel];
        [SINACircularBeadUtils makeCircularBead:5 andView:cancleUILabel andIsSetBackground:YES];
        
        
        //接受
        UILabel *selectUILabel = [[UILabel alloc]initWithFrame:CGRectMake(CGRectGetWidth(self.contentView.frame)/2+15,CGRectGetMaxY(remarkDesUILabel.frame)+8, CGRectGetWidth(self.contentView.frame)/2-30, 32)];
        selectUILabel.text=@"接受";
        selectUILabel.textAlignment=NSTextAlignmentCenter;
        selectUILabel.font=[UIFont systemFontOfSize:16];
        selectUILabel.textColor=[UIColor colorWithHexString:@"#ffffff"];
        
        self.selectUILabel=selectUILabel;
        [self.contentView addSubview:selectUILabel];
        [SINACircularBeadUtils makeCircularBead:5 andView:selectUILabel andIsSetBackground:YES];
        
        
        CGRect frame =  self.contentView.frame;
        frame.size.height=CGRectGetMaxY(selectUILabel.frame)+15;
        self.contentView.frame = frame;
        
        
    }
    return self;
}


- (UIView *)contentView
{
    if (!_contentView) {
        _contentView = [[UIView alloc]initWithFrame:CGRectMake(37,120, mainW-74,mainH-230)];
        [_contentView setBackgroundColor:[UIColor whiteColor]];
    }
    return _contentView;
}
//显示选择器
- (void)show
{
    [[UIApplication sharedApplication].keyWindow addSubview:self];
    [self setCenter:[UIApplication sharedApplication].keyWindow.center];
    [[UIApplication sharedApplication].keyWindow bringSubviewToFront:self];
    
    
    CGRect frame =  self.contentView.frame;
    frame.origin.y = mainH;
    self.contentView.frame = frame;
    frame.origin.y = 120;
    [UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
        [self.layer setOpacity:1.0];
        self.contentView.frame = frame;
        
    } completion:^(BOOL finished) {
    }];
    
}

//移除选择器
- (void)disMiss
{
    
    CGRect frame =  self.contentView.frame;
    frame.origin.y += self.contentView.frame.size.height;
    [UIView animateWithDuration:0.4 delay:0 options:UIViewAnimationOptionCurveEaseOut animations:^{
        [self.layer setOpacity:0.0];
        self.contentView.frame = frame;
    } completion:^(BOOL finished) {
        [self removeFromSuperview];
    }];
    
}








//设置显示数据 
-(void)setModel:(SINAStudentServiceItemModel *)model{
    _model = model;
    __block typeof(self) bself = self;
    if (self.pageStute==0) {
        //接收
        if (self.pageType==0) {
            //快递
            self.consigneeUILabel.text=[NSString stringWithFormat:@"收货人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"收货地址:%@",model.serviceLocation];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
            self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]];
            self.buyBehalfUILabel.text=[NSString stringWithFormat:@"快递公司:%@",model.sbuyBehal];
            //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            
            self.selectUILabel.text=@"接受";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(0,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else if(self.pageType==1){
            //打印复印
            self.consigneeUILabel.text=[NSString stringWithFormat:@"收件人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"收货地址:%@",model.serviceLocation];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
            self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]];//酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            
            self.selectUILabel.text=@"接受";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(0,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else if(self.pageType==2){
            //稍饭带饭
            self.consigneeUILabel.text=[NSString stringWithFormat:@"收货人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"收获地址:%@",model.serviceLocation];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
            self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]]; //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            self.selectUILabel.text=@"接受";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(0,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else{
            //超市代购
            
            self.consigneeUILabel.text=[NSString stringWithFormat:@"收货人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"收获地址:%@",model.serviceLocation];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
           self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]];self.buyBehalfUILabel.text=[NSString stringWithFormat:@"代购方式:%@",model.purchasetype];
            //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            
            self.selectUILabel.text=@"接受";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(0,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }
    }else{
        //委托
        if (self.pageType==0) {
            //快递
            self.consigneeUILabel.text=[NSString stringWithFormat:@"送货人:%@",model.userName];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
           self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]]; //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            //委托
            self.selectUILabel.text=@"委托";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(1,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else if(self.pageType==1){
            //打印复印
            self.consigneeUILabel.text=[NSString stringWithFormat:@"送件人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"邮箱/QQ:%@",model.qqOrEmail];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
            self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]];//酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            //委托
            self.selectUILabel.text=@"委托";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(1,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else if(self.pageType==2){
            //稍饭带饭
            self.consigneeUILabel.text=[NSString stringWithFormat:@"收货人:%@",model.userName];
            self.consigneeLocationUILabel.text=[NSString stringWithFormat:@"收获地址:%@",model.serviceLocation];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
            self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]];  //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            self.selectUILabel.text=@"委托";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(1,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }else{
            
            self.consigneeUILabel.text=[NSString stringWithFormat:@"代购人:%@",model.userName];
            self.peoplePhoneUILabel.text=[NSString stringWithFormat:@"联系电话:%@",model.servicePhone];
           self.serviceTimeUILabel.text=[NSString stringWithFormat:@"服务时间：%@-%@",[SINACalendarUtils getDateStringWithTimeStr:model.serviceStartTime andFormat:@"HH:mm"],[SINACalendarUtils getDateStringWithTimeStr:model.serviceEndTime andFormat:@"HH:mm"]]; self.buyBehalfUILabel.text=[NSString stringWithFormat:@"代购方式:%@",model.purchasetype];
            //酬金
            self.moneyNumberUILabel.text=[NSString stringWithFormat:@"%@RMB",model.moneyNumber];
            //备注
            self.remarkDesUILabel.text=[NSString stringWithFormat:@"%@",model.remarkDes];
            self.selectUILabel.text=@"委托";
            [[SINAUiviewClickLiserner alloc]viewClickFunction:self.selectUILabel andWithBlick:^(UIView *view) {
                [bself disMiss];
                if (bself.selectPhopeBlock) {
                    bself.selectPhopeBlock(1,bself.pageUid,bself.pageTypeString, bself.model);
                }
            }];
        }
    }
    
    NSString *remarkDes =model.remarkDes;
    if (remarkDes==nil||[remarkDes isEqualToString:@""]) {
        self.remarkDesUILabel.text=@"无";
        self.remarkDesUILabel.frame = CGRectMake(self.remarkDesUILabel.frame.origin.x, self.remarkDesUILabel.frame.origin.y, 20, 20);
    } else {
        CGSize maxSize = CGSizeMake(CGRectGetWidth(self.contentView.frame)-70, 21*3);
        CGRect rect = [remarkDes boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:@{NSFontAttributeName:self.remarkDesUILabel.font} context:nil];
        CGSize labelSize = rect.size;
        
        self.remarkDesUILabel.frame = CGRectMake(self.remarkDesUILabel.frame.origin.x, self.remarkDesUILabel.frame.origin.y, labelSize.width, labelSize.height);
        self.remarkDesUILabel.text=remarkDes;
        
        self.cancleUILabel.frame=CGRectMake(15,CGRectGetMaxY(self.remarkDesUILabel.frame)+12, CGRectGetWidth(self.contentView.frame)/2-25, 32);
        self.selectUILabel.frame=CGRectMake(CGRectGetWidth(self.contentView.frame)/2+15,CGRectGetMaxY(self.remarkDesUILabel.frame)+12, CGRectGetWidth(self.contentView.frame)/2-30, 32);
        
        CGRect frame =  self.contentView.frame;
        frame.size.height=CGRectGetMaxY(self.selectUILabel.frame)+15;
        self.contentView.frame = frame;
    }
    
    
  
    [self.userTitleImageView sd_setImageWithURL:[NSURL URLWithString:model.userTitleImageUrl] placeholderImage:[UIImage imageNamed:@"默认头像"]];
    
    //再逛一逛
    self.cancleUILabel.text=@"再逛一逛";
    [[SINAUiviewClickLiserner alloc]viewClickFunction:self.cancleUILabel andWithBlick:^(UIView *view) {
        [bself disMiss];
    }];
    SINAUserModel *userModel = [[SINACommonUserHelper share] getUserModel];
    
    NSString *userUid = userModel.userUid;
    if ([userUid isEqualToString:model.userUUID]) {
         self.selectUILabel.backgroundColor=[UIColor colorWithHexString:@"#b0b0b0"];
    }
}






@end
